#include <stdio.h>
#include <unistd.h>
#include <assert.h>
int g_val = 100;
int main(){
  pid_t id = fork();
  assert(id>=0);
  if(id==0){
    while(1){
        printf("我是子进程,pid为:%d,我的父进程是:%d,g_val值为%d,&g_val值为%p\n"\
            ,getpid(),getppid(),g_val,&g_val);
        sleep(1);
        g_val++;
    }
  }else{
    while(1){
        printf("我是父进程,pid为:%d,我的父进程是:%d,g_val值为%d,&g_val值为%p\n"\
            ,getpid(),getppid(),g_val,&g_val);
        sleep(1);
    }
  }
  return 0;
}
